#导包
import jsonschema
#准备到校验的json数据
data={
    "success": True,
    "code": 10000,
    "message": "操作成功"
}
#定义 jsonschema格式数据校验规则
schema={
    "type": "object",
    "properties": {
        "success": {
            "type": "boolean"
        },
        "code": {
            "type": "integer"
        },
        "message": {
            "type": "string"
        }
    },
    "required": ["success", "code", "message"]
}

#调用jsonschema.validate(instance="json数据",schema="jsonschema规则")
res=jsonschema.validate(instance=data,schema=schema)
print("res=",res)